require.config({
                baseUrl:"../",
	paths:{
		bsl:'bsl',

	}
});
require(['bsl'],function(bsl){
	document.addEventListener('deviceready', onDeviceready, false);
        
        function onDeviceready(){
            alert("star");
        
        function getCurrentProximity() {
        var options = 1;
        bsl.proximity.getCurrentProximity(onSuccess1, onError1,options);
        }
        
        function onSuccess1(Proximity) {
        alert('Proximity: ' + Proximity);
        document.getElementById('proximity').innerHTML=Proximity;
        }
        
        function onError1(proximityError) {
        alert('Proximity Error: ' + proximityError);
        }
        
        function startWatch() {
        
        bsl.proximity.watchProximity(onSuccess3, onError4);
        
        }
        
        
        
        function onSuccess3(Proximity) {
        document.getElementById('proximity').innerHTML= Proximity;
        }
        
        function onError4(proximityError) {
        alert('Proximity Error: ' + proximityError);
        }
        
        
        function stopWatch() {
        
        bsl.proximity.clearWatch();

        }
        
        
    document.getElementById("getCurrentProximity").addEventListener("click",getCurrentProximity,false);
    document.getElementById("startWatch").addEventListener("click",startWatch,false);
    document.getElementById("stopWatch").addEventListener("click",stopWatch,false);
        }
        
});